home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11327 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  54 lines

  1. Path: rcp6.elan.af.mil!rscernix!root
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: 16-bit memset?
  5. Date: 20 Mar 96 15:04:38 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <root.827334278@rscernix>
  8. References: <joules-1803962243060001@badboy.mit.edu> <4ill6r$qnm@nntp.interaccess.com> <DoJABC.Hy7@iquest.net>
  9. NNTP-Posting-Host: ues5.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11.  
  12. In <DoJABC.Hy7@iquest.net> dlmiller@iquest.net (Doug Miller) writes:
  13.  
  14. >+Julian Orbanes wrote:
  15. >+>I am looking quick way to set a series of 16-bit values to one value.
  16. >+>
  17. >+>Analagous to how memset set works with 8-bit values. (For graphics
  18. >+>purposes).
  19. >
  20. >char    *bigstuff;
  21. > . .
  22. >/* assuming that:                                */
  23. >/*    1) you have allocated storage for bigstuff                */
  24. >/*    2) it is a null-terminated string of the desired FINAL length            */
  25. >/*    3) you have loaded the value you wish to propagate into the first 2 bytes    */
  26. >
  27. >strncpy (bigstuff + 2, bigstuff, (strlen (bigstuff) - 2));
  28.  
  29. Please don't post garbage to this newsgroup.  First learn C, then post
  30. advice.
  31.  
  32.     4.11.2.4 The strncpy function
  33.  
  34.     Synopsis
  35.  
  36.          #include <string.h>
  37.          char *strncpy(char *s1, const char *s2, size_t n);
  38.  
  39.     Description
  40.  
  41.     The strncpy function copies not more than n characters (characters
  42.     that follow a null character are not copied) from the array pointed to
  43.     by s2 to the array pointed to by s1.  If copying takes place
  44.                                           ^^^^^^^^^^^^^^^^^^^^^^
  45.     between objects that overlap, the behavior is undefined.
  46.     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  47.                                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  48. Dan
  49. --
  50. Dan Pop
  51. CERN, CN Division
  52. Email: danpop@mail.cern.ch 
  53. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  54.